Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): execute commands without file paths #2726

Merged
merged 13 commits into from
May 6, 2024

Conversation

unvalley
Copy link
Member

@unvalley unvalley commented May 5, 2024

Summary

This PR allows lint, format, check and ci commands to be executed without the file paths argument.
e.g. biome lint . -> biome lint

Closes #2266

Test Plan

  • Added tests
  • Executed biome lint, biome format, biome check by using bin
  • [-] Update documents
    • This should be done in website repo.

@github-actions github-actions bot added the A-CLI Area: CLI label May 5, 2024
@github-actions github-actions bot added the A-Changelog Area: changelog label May 6, 2024
@unvalley unvalley marked this pull request as ready for review May 6, 2024 05:08
@unvalley unvalley requested a review from Conaclos May 6, 2024 05:14
@ematipico ematipico added the S-Feature Status: new feature to implement label May 6, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
crates/biome_cli/src/execute/traverse.rs Show resolved Hide resolved
Co-authored-by: Victorien Elvinger <[email protected]>
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome feature! We need to add a test for the ci command

CHANGELOG.md Outdated Show resolved Hide resolved
crates/biome_cli/src/execute/traverse.rs Show resolved Hide resolved
Args::from([("lint"), ""].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we forgot to add a snapshot assertion

Copy link
Member Author

@unvalley unvalley May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this is a test for ok (without lint errors ) case, I'll change this to a test that emits lint errors with snapshot.

Args::from([("check"), ""].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot the snapshot assertion

@unvalley unvalley changed the title feat(cli): execute lint, format, check without file paths feat(cli): execute commands without file paths May 6, 2024
Copy link
Member

@Conaclos Conaclos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This will greatly improve DX :)

@unvalley unvalley merged commit 9301f53 into biomejs:main May 6, 2024
10 checks passed
@unvalley unvalley deleted the execute-command-without-paths branch May 6, 2024 11:17
| TraversalMode::Lint { .. }
| TraversalMode::Format { .. }
| TraversalMode::CI { .. } => match current_dir() {
Ok(current_dir) => inputs.push(current_dir.into_os_string()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the relative path instead of the absolute path here? It seems that our globs don't work well with absolute paths.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we remove the prefix of the current_dir, I think it would be the relative path. I'll check that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also improve hyperlinks in the CLI: generally IDE expects relative paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-CLI Area: CLI S-Feature Status: new feature to implement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

📎 Execute Biome command on the working directory by default
5 participants